import { createBrowserRouter } from 'react-router-dom'
import App from '../App'
import Login from '../views/login/index'
import Home from '../views/Home'
import Error from '../views/Error'
import FlowChart from '../views/flow-chart'
import UploadFile from '../views/upload-file'
import AvatarToCartoon from '../views/img-cartoon/AvatarToCartoon'

const router = createBrowserRouter([
  { // 重定向到 home 页
    path: '/',
    element: <App />,
    errorElement: <Error />,
    children: [
      {
        path: '/home', // 首页
        element: <Home />,
      },
      {
        path: '/avatar-to-cartoon',
        element: <AvatarToCartoon />
      },
    ]
  },
  { // 登录页
    path: 'login',
    element: <Login />
  },
  {
    path: 'flowchart',
    element: <FlowChart />
  },
  {
    path: 'uploadfile',
    element: <UploadFile />
  },
  // { 
  //   path: '/',
  //   element: <App />,
  // }
])

export default router